{% extends 'layout/base.html' %}
{% block title %} 用户中心 {% endblock %}
{% block main %}
<h1 class="h1">用户中心</h1>
<div class="row">
    {% include 'user/layout/left_sidebar.html' %}
    <div class="col-md-9">
        <div class="container-fluid">
            <ul class="list-group">
                <li class="list-group-item">
                    <!-- <span class="badge">14</span> -->
                    <b>昵称: </b> {{ current_user.username }}
                </li>
                <li class="list-group-item">
                    <b>介绍: </b> {{ current_user.intro }}
                </li>
            </ul>
            <hr>
            <div class="posts">
                {% for post in posts %}

                {% if post.draft == "false" %}
                <div class="media border" style="margin-top: 10px;">
                    <a href="{{ url_for('main.user_article_page', aid=post.id, uid=post.user_id) }}">
                        <img style="width: 100px;" src="{{ post.cover_url }}" class="mr-3" alt="cover_url">
                    </a>
                    <div class="media-body">
                        <div>
                            <h5 class="mt-0"><a href="{{ url_for('main.user_article_page', aid=post.id, uid=post.user_id) }}">
                                {{post.title}}
                            </a></h5>
                            <span style="color:#898989">{{ post.created_time }}</span>
                        </div>
                        <p style="word-break:break-all;">{{post.abstract}}</p>
                        <div style="font-size: x-small;">
                            {% for t in post.tags.all() %}
                            <span> {{t.name}} </span>
                            {% endfor %}
                        </div>
                    </div>
                </div>
                {% else %}
                <div class="border" style="margin-top:10px; word-break:break-all;">
                    <div style="color:#898989">
                        发布时间: {{ post.created_time }}
                    </div>
                    <p> {{ post.body }} </p>
                </div>
                {% endif %}
                {% endfor %}
            </div>
        </div>
    </div>
</div>
{% endblock %}